package model;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

//import oracle.ucp.jdbc.PoolDataSource;
//import oracle.ucp.jdbc.PoolDataSourceFactory;

public class ConnectionPool {
	public static Connection getConnection() throws DatabaseException {
		 Connection dbCon=null;
		 try {
			 Class.forName("oracle.jdbc.driver.OracleDriver");
			 dbCon = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/xe","store","store");
			
		 } catch (Exception e) {
			 throw new DatabaseException(e);
		 }
		
		 return dbCon;
	}

}

//	public static PoolDataSource pds = null;
//
//	public static Connection getConnection() throws DatabaseException{
//		if (pds == null) {
//			try {
//				pds = PoolDataSourceFactory.getPoolDataSource();
//				pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
//				pds.setURL("jdbc:oracle:thin:@localhost:1521/xe");
//				pds.setUser("store");
//				pds.setPassword("store");
//			} catch (SQLException e) {
//				throw new DatabaseException(e);
//			}
//		}
//		Connection con;
//		try {
//			con = pds.getConnection();
//		} catch (SQLException e) {
//			throw new DatabaseException(e);
//		}
//		return con;
//	}
//
//}

